package com.brspace.qualitycontrol.controller.admin;


import com.brspace.qualitycontrol.entity.Duty;
import com.brspace.qualitycontrol.mapper.DutyMapper;
import com.brspace.qualitycontrol.service.DutyService;
import com.brspace.qualitycontrol.utils.R;
import io.swagger.annotations.Api;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-04-29
 */
@Api(description = "值班值守")
@RestController
@RequestMapping("/admin/duty")
public class DutyController {

    @Resource
    private DutyMapper dutyMapper;
    @Resource
    private DutyService dutyService;

    /**
     *更新信息
     *@author Hugo
     *@date 2021-04-29 20:18
     **/
    @PostMapping("updateInfo")
    public R update(@RequestBody Duty duty){
        dutyMapper.updateById(duty);
        return R.ok();
    }

    /**
     *展示信息
     *@author Hugo
     *@date 2021-04-29 20:18
     **/
    @PostMapping("getInfor")
    public R getInfo(){
        return R.ok().data("list",dutyMapper.selectList(null));
    }

    /**
     *获取加班前四天人员
     *@author Hugo
     *@date 2021-04-30 10:09
     **/
    @PostMapping("getData")
    public R getData(){
        return R.ok().data("list",dutyService.getData());
    }

}

